home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / csp100 / csp.doc next >
Text File  |  1991-03-15  |  9KB  |  331 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                                                      Page 1
  8.  
  9.  
  10.      WHAT IS CSP?
  11.  
  12.      CSP (CS Preprocessor) uses the Microsoft C or QuickC compiler as a
  13.      Telix SALT preprocessor, giving the SALT compiler conditional compile,
  14.      include file, and macro capabilities.
  15.  
  16.      CSP requires Microsoft's QCL.EXE or CL.EXE in one of the directories
  17.      in your PATH.  
  18.  
  19.  
  20.      WHAT DOES IT DO?
  21.  
  22.      Not a whole lot.  It runs a script file (for example FOO.SLT) through
  23.      the Microsoft C compiler (either QCL or CL) with the /P switch to
  24.      create an intermediate file.  The intermediate file is lightly edited,
  25.      then given to the SALT compiler (CS.EXE).  Line references in CS error
  26.      messages are changed from the file and line of the intermediate file
  27.      to the original file and line number.
  28.  
  29.  
  30.      FILES INCLUDED:
  31.  
  32.           CSP.EXE   SALT "preprocessor".
  33.           CSP.DOC   This file.
  34.           CSP.WP5   WordPerfect 5.1 version of this file.
  35.  
  36.      HOW DO I USE IT?
  37.  
  38.      The simple syntax is:
  39.  
  40.           CSP sourcefile [outputfile]
  41.  
  42.      Which will preprocess and compile a SALT source file.  If an output
  43.      name is given CSP uses it to determine output file names, otherwise
  44.      output files are named after the source file.
  45.  
  46.      The full syntax is:
  47.  
  48.           CSP [-Q"CMD"] [-PC] [-D MACRO=VALUE]... [-I DIR] [-b]
  49.               [-sstack] sourcefile [outputfile]
  50.  
  51.      switches (which may begin with either '-' or '/') are:
  52.  
  53.      -Q     Use CMD as preprocessor.
  54.      -P     Preprocess only, do not compile.  Creates a .SLI file.
  55.      -C     Tell C preprocessor not to strip comments.
  56.      -D     Tell C preprocessor to define MACRO as VALUE.
  57.      -I     Tell C preprocessor to search DIRECTORY for include files.
  58.      -l     Compile a C-preprocessed SALT file.
  59.      -b     Compress runs of blank lines to one blank line.
  60.      -e     Send C preprocessor error output to standard output.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                                                                      Page 2
  74.  
  75.      -s     Sets the stack size used by the SALT compiler.
  76.  
  77.  
  78.  
  79.      EXPLANATIONS OF OPTIONS:
  80.  
  81.      -Q     Use CMD as preprocessor.
  82.  
  83.      CSP usually uses either QCL or CL as the C preprocessor.  If you have
  84.      another C compiler that can produce compatible preprocessed output /Q
  85.      will force CSP to use it.  If the command requires switches the whole
  86.      command string must be quoted.  For instance if you want CSP to use CL
  87.      instead of QCL (which it would do anyway if it didn't find QCL but I
  88.      can't think of a better example) use:
  89.  
  90.         CSP -Q"CL /P" FOO.SLT
  91.  
  92.  
  93.      -P     Preprocess only, do not compile.  Creates a .SLI file.
  94.  
  95.      CSP will send the file through the C preprocessor and create a CS-
  96.      compilable SLI file, but will not compile it.
  97.  
  98.  
  99.      -C     Tell C preprocessor not to strip comments.
  100.  
  101.      This passes the "/C" switch to the C preprocessor which tells it not
  102.      to strip comments from the source file.
  103.  
  104.  
  105.      -D     Tell C preprocessor to define MACRO as VALUE.
  106.  
  107.      Each -DMACRO=VALUE used passes a "/DMACRO=VALUE" to the C preprocessor
  108.      to define a macro.
  109.  
  110.  
  111.      -l     Compile a C-preprocessed SALT file.
  112.  
  113.      If you have another C compiler that produces Microsoft-compatible
  114.      preprocessor output, you can preprocess the script first then use CSP
  115.      with the -l switch on the output file.  It will not preprocess the
  116.      file, but will compile it with CS and change line references in CS
  117.      error messages.
  118.  
  119.  
  120.      -b     Compress runs of blank lines to one blank line.
  121.  
  122.      Usually the C preprocessor replaces lines containing preprocessor
  123.      directives and "switched off" code with blank lines.  This option
  124.      replaces multiple blank lines with one blank line, resulting in a more
  125.      presentable SLI file.
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                                                                      Page 3
  140.  
  141.      -e     Send C preprocessor error output to standard output.
  142.  
  143.      This will force the C preprocessor to send all it's messages to the
  144.      standard output, allowing it to be redirected with '>', '>>', and '|'.
  145.  
  146.  
  147.      -s     Sets the stack size used by the SALT compiler.
  148.  
  149.      This option is passed to the SALT compiler to set the stack size of
  150.      the compiled SLC file.
  151.  
  152.  
  153.      Since you have to have a C compiler to use this I'm assuming you are
  154.      either already familiar with the C preprocessor directives or have
  155.      them documented elsewhere, and they won't be described here. 
  156.      Obviously they work here just as they do in C, since the C compiler is
  157.      doing the preprocessing.  Some notes:
  158.  
  159.      There are a few preprocessor directives that QCL does not remove
  160.      (#pragma for instance), and these are stripped by CSP before the SALT
  161.      compile.  
  162.  
  163.  
  164.      CSP will complain about code like this:
  165.  
  166.           #define FOUR 2+2
  167.           int x=FOUR;
  168.  
  169.      Because neither the C preprocessor nor CS replaces "2+2" with "4", so
  170.      the second line actually evalutes to:
  171.  
  172.           int x=2+2;
  173.  
  174.      and the SALT compiler only allows variable declarations to initialize
  175.      a variable to a constant, not an expression.  If you can't reduce the
  176.      macro to a constant then the the variable must be declared and
  177.      intialized separately:
  178.  
  179.           #define FOUR 2+2
  180.           int x;
  181.           x=FOUR;
  182.  
  183.  
  184.      Because the C preprocessor strips comments by default, SALT scripts
  185.      that are preprocessed with CSP can contain C-style "/* */" comments,
  186.      as long as the -C switch is not used.
  187.  
  188.  
  189.      DISCLAIMER:
  190.  
  191.      CSP is provided on an "as is" basis without warranty of any kind,
  192.      expressed or implied, including but not limited to the implied
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                                                                      Page 4
  206.  
  207.      warranties of merchantability and fitness for a particular purpose.
  208.      The person using the software bears all risk as to the quality and
  209.      performance of the software.  Should the software prove defective, the
  210.      user assumes the entire cost of all necessary repair, servicing, or
  211.      correction.  The author will not be liable for any special,
  212.      incidental, consequential, indirect or  similar damages due to loss of
  213.      data or any other reason, even if the author or an agent of the author
  214.      has been advised of the possibility of such damages.  In no event
  215.      shall the author's liability for any damages ever exceed the price
  216.      paid for the license to use the software, regardless of the form of
  217.      the claim.                        
  218.  
  219.      There is no charge for private, non-commercial use of CSP (but if you
  220.      send a check anyway it won't go uncashed).  If you use CSP in the
  221.      development of scripts which are sold to others, a $10 registration is
  222.      required.  Comments, suggestions, and requests can be left at:
  223.  
  224.             The Dead of Night BBS
  225.             (703) 644-7667
  226.  
  227.      or mailed to:
  228.  
  229.             Donald Mehrtens
  230.             5923 Minuteman Rd
  231.             Springfield VA 22152
  232.  
  233.      or sent via CompuServe (which I don't check very often) to ID
  234.      72361,1407.
  235.  
  236.  
  237.      SALT Authors, HELP!
  238.  
  239.      Is there any way for a script to determine its own name, as DOS batch
  240.      files can do with %0 or C programs can do with argv[0]?
  241.  
  242.      Some scripts run considerably slower if _scr_chk_key is set to 0 to
  243.      disable the ESC key from prompting to abort the script.  Can anything
  244.      be done about this?  Can the ESC key be prevented from aborting
  245.      scripts without using _scr_chk_key?
  246.  
  247.      Is there any way to find out whether the cursor is on or off?
  248.  
  249.      Is there a cleaner way to find out if the status bar is on than to
  250.      look on the screen for it with vgetchr/vgetstr?
  251.  
  252.      Is there a way to see if a local key has been hit without destroying
  253.      the terminal() function's ability to process it, like cinp_count()
  254.      does with the comm port?
  255.  
  256.      Despite the fact that Telix does not appear able to do anything with
  257.      them, CS will happily compile a script that has no main() function. 
  258.      Is this of any use?
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                                                                      Page 5
  272.  
  273.      Can a script find out which dialing directory entries are marked?  Can
  274.      a script mark and unmark entries?
  275.  
  276.      And does ANYBODY know ANYTHING about Telix 4.0?
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.